package com.corticon.dialogs.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


/**
 * This model class used for the audit.
 *
 * @author Yanglifan
 */
@MappedSuperclass
public class AuditableEntity implements Auditable {

    private User modifiedBy;
    private Date modifiedOn;

    @Override
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "lastmodbyassoc_userid_oid")
    public User getModifiedBy() {
        return modifiedBy;
    }

    @Override
    public void setModifiedBy(User modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    @Override
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "lastmodified")
    public Date getModifiedOn() {
        return modifiedOn;
    }

    @Override
    public void setModifiedOn(Date modifiedOn) {
        this.modifiedOn = modifiedOn;
    }
}
